package com.googlecode.flightreports.countrysummary;

import java.util.Date;
import java.util.List;
import org.xml.sax.InputSource;  // report is used as a SAX input stream

/**
 * This bean holds the data values needed for this report
 * 
 */
public class ReportObject extends InputSource {
    private Date runDate;
    
    private List<Country> countryList =
        new java.util.ArrayList<Country>();
    
    // scalars    
    public Date getRunDate() {
        return runDate;
    }

    public void setRunDate(Date runDate) {
        this.runDate = runDate;
    }   

    // lists    
    public void addCountry(Country country) {
        countryList.add(country);
    }

    public List getCountries() {
        return countryList;
    }
    
    public static class Country {
        private String name;
        private String isoCode;
        private String region;
        
        private List<City> cityList =
            new java.util.ArrayList<City>();

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public String getISOCode() {
            return isoCode;
        }

        public void setISOCode(String isoCode) {
            this.isoCode = isoCode;
        }

        public String getRegion() {
            return region;
        }

        public void setRegion(String region) {
            this.region = region;
        }

        // lists
        public void addCity(City city) {
            cityList.add(city);
        }

        public List getCities() {
            return cityList;
        }
        
        @Override
        public String toString() {
            StringBuffer buffer = new StringBuffer();
            buffer.append("Country[");
            buffer.append(" name = ").append(name);
            buffer.append(" ISO code = ").append(isoCode);
            buffer.append(" region = ").append(region);
            buffer.append("]");
            return buffer.toString();
        }
    }

    public static class City {
        private String name;
        private String airport;
        private String language;
        private int arrivalCount;
        private int departureCount;

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public String getAirport() {
            return airport;
        }

        public void setAirport(String airport) {
            this.airport = airport;
        }

        public String getLanguage() {
            return language;
        }

        public void setLanguage(String language) {
            this.language = language;
        }
        
        public int getArrivalCount() {
            return arrivalCount;
        }

        public void setArrivalCount(int count) {
            this.arrivalCount = count;
        }

        public int getDepartureCount() {
            return departureCount;
        }

        public void setDepartureCount(int count) {
            this.departureCount = count;
        }

        @Override
        public String toString() {
            StringBuffer buffer = new StringBuffer();
            buffer.append("City[");
            buffer.append(" name = ").append(name);
            buffer.append(" airport = ").append(airport);
            buffer.append(" language = ").append(language);
            buffer.append(" arrivalCount = ").append(arrivalCount);
            buffer.append(" departureCount = ").append(departureCount);
            buffer.append("]");
            return buffer.toString();
        }
    }
}
